-
Notifications
You must be signed in to change notification settings - Fork 13.8k
cg_llvm: Use LLVMDIBuilderCreateGlobalVariableExpression
#147608
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
+150
−93
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
r? @nnethercote rustbot has assigned @nnethercote. Use |
Note that the code in `LLVMRustDIBuilderCreateStaticVariable` that tried to downcast `InitVal` appears to have been dead, because `llvm::ConstantInt` and `llvm::ConstantFP` are not subclasses of `llvm::GlobalVariable`.
nnethercote
approved these changes
Oct 13, 2025
@bors r+ rollup |
GuillaumeGomez
added a commit
to GuillaumeGomez/rust
that referenced
this pull request
Oct 13, 2025
cg_llvm: Use `LLVMDIBuilderCreateGlobalVariableExpression` - Part of rust-lang#134001 - Follow-up to rust-lang#146763 --- This PR dismantles the somewhat complicated `LLVMRustDIBuilderCreateStaticVariable` function, and replaces it with equivalent calls to `LLVMDIBuilderCreateGlobalVariableExpression` and `LLVMGlobalSetMetadata`. A key difference is that the new code does not replicate the attempted downcast of `InitVal`. As far as I can tell, those downcasts were actually dead, because `llvm::ConstantInt` and `llvm::ConstantFP` are not subclasses of `llvm::GlobalVariable`. I tried replacing those code paths with fatal errors, and was unable to induce failure in any of the relevant test suites I ran. I have also confirmed that if the calls to `create_static_variable` are commented out, debuginfo tests will fail, demonstrating some amount of relevant test coverage. The new `DIBuilder` methods have been added via an extension trait, not as inherent methods, to avoid impeding rust-lang#142897.
This was referenced Oct 13, 2025
bors
added a commit
that referenced
this pull request
Oct 13, 2025
Rollup of 6 pull requests Successful merges: - #147514 (repr_transparent_external_private_fields: normalize types during traversal) - #147605 (Add doc links between `{integer}::from_str_radix` and `from_str`) - #147608 (cg_llvm: Use `LLVMDIBuilderCreateGlobalVariableExpression`) - #147623 (Clear `ChunkedBitSet` without reallocating) - #147625 (Add a warning when running tests with the GCC backend and debug assertions are enabled) - #147626 (Generalize configuring LLD as the default linker in bootstrap) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
that referenced
this pull request
Oct 13, 2025
Rollup merge of #147608 - Zalathar:debuginfo, r=nnethercote cg_llvm: Use `LLVMDIBuilderCreateGlobalVariableExpression` - Part of #134001 - Follow-up to #146763 --- This PR dismantles the somewhat complicated `LLVMRustDIBuilderCreateStaticVariable` function, and replaces it with equivalent calls to `LLVMDIBuilderCreateGlobalVariableExpression` and `LLVMGlobalSetMetadata`. A key difference is that the new code does not replicate the attempted downcast of `InitVal`. As far as I can tell, those downcasts were actually dead, because `llvm::ConstantInt` and `llvm::ConstantFP` are not subclasses of `llvm::GlobalVariable`. I tried replacing those code paths with fatal errors, and was unable to induce failure in any of the relevant test suites I ran. I have also confirmed that if the calls to `create_static_variable` are commented out, debuginfo tests will fail, demonstrating some amount of relevant test coverage. The new `DIBuilder` methods have been added via an extension trait, not as inherent methods, to avoid impeding #142897.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-LLVM
Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
cg_llvm
debuginfo handling to use the LLVM-C API #134001This PR dismantles the somewhat complicated
LLVMRustDIBuilderCreateStaticVariable
function, and replaces it with equivalent calls toLLVMDIBuilderCreateGlobalVariableExpression
andLLVMGlobalSetMetadata
.A key difference is that the new code does not replicate the attempted downcast of
InitVal
. As far as I can tell, those downcasts were actually dead, becausellvm::ConstantInt
andllvm::ConstantFP
are not subclasses ofllvm::GlobalVariable
. I tried replacing those code paths with fatal errors, and was unable to induce failure in any of the relevant test suites I ran.I have also confirmed that if the calls to
create_static_variable
are commented out, debuginfo tests will fail, demonstrating some amount of relevant test coverage.The new
DIBuilder
methods have been added via an extension trait, not as inherent methods, to avoid impeding #142897.